package com.roncoo.course.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.roncoo.course.entity.EduCourse;
import com.roncoo.course.entity.Lecturer;
import com.roncoo.course.service.LecturerService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author wdf
 * @since 2021-04-07
 */
@Controller
@RequestMapping("/lecturer")
public class LecturerController {
    @Resource
    private LecturerService lecturerService;

    @ApiOperation(value = "根据用户id查找教师id")
    @PostMapping("findTidByUid/{id}")
    @ResponseBody
    public List<EduCourse> findTidByUid(@PathVariable("id") Integer id){
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("lecturer_user_id",id);
        return lecturerService.list(queryWrapper);
    }

    /**
     * 根据id查询教师数据
     */
    @GetMapping("findById")
    @ResponseBody
    public Lecturer findById(Integer lecturerId){
        return lecturerService.getById(lecturerId);
    }

}

